package com.woniu.controller;

import com.woniu.entity.RbacManager;
import com.woniu.entity.ResponseEntity;
import com.woniu.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.security.auth.login.LoginException;

/**
 * @author Rain
 * @Description :
 * @date 2022/08/31 19:17
 */
@RestController
@CrossOrigin
public class LoginController {
    @Autowired
    LoginService service;

    @GetMapping("/login")
    public ResponseEntity login(String username, String password) throws LoginException {
        return service.login(username, password);
    }

    @RequestMapping("/401")
    public ResponseEntity response401() {
        return ResponseEntity.AUTHFAILED;
    }
}
